﻿<Window x:Class="MP3Tunes.WPF.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:tulde="clr-namespace:Tulde.Windows.App.Controls;assembly=Tulde.Windows.App.Controls"
        Title="MP3 Tunes Streaming Player" Height="500" Width="625" WindowState="Maximized" Background="Black" Foreground="White" Icon="/MP3Tunes.WPF;component/App.ico">
    <Window.Resources>

        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources\CustomHorizontalListBox.xaml"/>
                <ResourceDictionary Source="Resources\CustomVerticalListBox.xaml"/>
                <ResourceDictionary  Source="Resources\ScrollBar.xaml"/>
                <ResourceDictionary  Source="Resources\GlassButton.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
        


    </Window.Resources>
    <Grid >

        <Grid.RowDefinitions>
            <RowDefinition Height="55"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="105"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="256" />
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Border  Grid.ColumnSpan="2" Margin="5" BorderBrush="Blue" CornerRadius="10">
            <ToolBar x:Name="mainToolbar1" ToolBarTray.IsLocked="True" >
                <ToolBar.Background>


                    <LinearGradientBrush  EndPoint="0.504,1.5" StartPoint="0.504,0.03">
                        <GradientStop Color="#a0b7dc" Offset="0"/>
                        <GradientStop Color="Transparent" Offset="0.367"/>
                    </LinearGradientBrush>
                </ToolBar.Background>
                
                
                <DockPanel  HorizontalAlignment="Stretch">
                    <StackPanel Orientation="Horizontal"  DockPanel.Dock="Left">



                        <TextBox x:Name="searchPattern" Width="150" Margin="10,0,10,0"  FontSize="14"  VerticalAlignment="Center"  ></TextBox>
                        <Button x:Name="searchButton" HorizontalAlignment="Left"  Width="100" Height="34" Content="Search" Foreground="#FFFFFFFF" Template="{DynamicResource GlassButton}" Click="searchButton_Click"  Margin="5,0,5,0" />
                        <Button x:Name="clearButton" Width="100" Height="34" Content="Clear" Foreground="#FFFFFFFF" Template="{DynamicResource GlassButton}" Click="clearButton_Click"  Margin="5,0,5,0" />
                        <Button x:Name="shuffleSongs"  Width="100"  DockPanel.Dock="Right" Height="34" Content="Shuffle Songs" Foreground="#FFFFFFFF" Template="{DynamicResource GlassButton}"  Margin="5,0,5,0"/>

                    </StackPanel>
                   
                </DockPanel>
            </ToolBar>
        </Border>
        <DockPanel Margin="3" Grid.Row="1">

            <ListBox DockPanel.Dock="Top" Style="{StaticResource BlackListBox}"  Grid.Row="1" Grid.Column="0" ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Auto" ItemsSource="{Binding}" x:Name="listArtists" OpacityMask="#FF000000" Opacity="0.8" BorderThickness="0"  >
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Margin="0,0,0,5" >


                            <TextBlock Text="{Binding ArtistName}" TextWrapping="Wrap" />

                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>

            </ListBox>

        </DockPanel>



        <Grid Grid.Row="1" Grid.Column="1" x:Name="rightGrid" Margin="5" >
            <!--<Grid.Background>
                <DrawingBrush>
                    <DrawingBrush.Drawing>
                        <DrawingGroup Opacity="0.3">
                            <DrawingGroup.OpacityMask>
                                <LinearGradientBrush x:Name="grad1" StartPoint="0,1" EndPoint="0,1">
                                    <GradientStop Offset="0" Color="Transparent"></GradientStop>
                                    <GradientStop Offset="0.4" Color="Black"></GradientStop>
                                </LinearGradientBrush>



                            </DrawingGroup.OpacityMask>
                          
                            <ImageDrawing x:Name="backgroundArt" Rect="50,50,50,50">

                            </ImageDrawing>
                        </DrawingGroup>
                      
</DrawingBrush.Drawing>
                 
                </DrawingBrush>
            </Grid.Background>-->
            <Grid.ColumnDefinitions>

                <ColumnDefinition Width="*"></ColumnDefinition>

            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="170"/>
                <RowDefinition Height="130"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <ListBox   Style="{StaticResource BlackHorizontalListBox}"  ItemsSource="{Binding}" x:Name="listAlbums" Grid.Row="0" Grid.Column="1" OpacityMask="#FF000000" Opacity="0.8" Width="Auto" BorderThickness="0" FlowDirection="LeftToRight" >
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Margin="10" Orientation="Vertical"   >

                            <Border BorderThickness="2" Width="100" Height="100" CornerRadius="3">
                                <Border.BorderBrush>
                                    <SolidColorBrush Color="LightGray"/>
                                </Border.BorderBrush>
                                <Image Source="{Binding Path=AlbumArtUrl}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                    <Image.BitmapEffect>
                                        <OuterGlowBitmapEffect GlowColor="Gray" GlowSize="50"/>
                                    </Image.BitmapEffect>
                                </Image>
                            </Border>

                            <TextBlock Text="{Binding AlbumTitle}" TextWrapping="Wrap" TextAlignment="Center" />

                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>

            </ListBox>
            <Grid Grid.Row="1" Background="Transparent">
                <Grid.RowDefinitions>

                    <RowDefinition Height="70"/>
                    <RowDefinition Height="50"/>


                </Grid.RowDefinitions>

                <!--<tulde:TextPath Grid.Row="0"   Fill="White"  FontSize="48" Name="artistNameText" StrokeThickness="2" HorizontalAlignment="Center" />



                <tulde:TextPath Grid.Row="1"  Fill="White"   FontSize="28" Name="albumNameText" HorizontalAlignment="Center" />-->

                <TextBlock Grid.Row="0" TextAlignment="Center"  FontSize="48" Name="artistNameText" Foreground="White" Background="Transparent"></TextBlock>
                <TextBlock Grid.Row="1" TextAlignment="Center"  FontSize="28" Name="albumNameText" Foreground="White" Background="Transparent"></TextBlock>
            </Grid>


            <Grid VerticalAlignment="Top"   Grid.Column="0" Grid.Row="2" HorizontalAlignment="Center">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="160*" />
                    <ColumnDefinition Width="200*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>


                    <RowDefinition Height="*" />

                </Grid.RowDefinitions>

                <Border Visibility="Hidden" Name="borderAlbumArt" BorderThickness="2" Width="150" Height="150" CornerRadius="3" Grid.Row="0" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,0,30,0" >
                    <Border.BorderBrush>
                        <SolidColorBrush Color="LightGray"/>
                    </Border.BorderBrush>
                    <Image Name="albumArt"  Width="150" Height="150"  VerticalAlignment="Top" HorizontalAlignment="Center" >
                        <Image.BitmapEffect>
                            <OuterGlowBitmapEffect GlowColor="Gray" GlowSize="50"/>
                        </Image.BitmapEffect>
                    </Image>
                </Border>



                <ListBox HorizontalAlignment="Center" Grid.Column="1"  Grid.Row="0" ItemContainerStyle="{StaticResource ContainerStyle}"  ItemsSource="{Binding}" VerticalAlignment="Top" x:Name="listTracks" OpacityMask="#FF000000" Opacity="0.8" BorderThickness="0" Width="250" Style="{StaticResource BlackListBox}" >


                </ListBox>

            </Grid>



        </Grid>
        <tulde:MediaPlayer x:Name="mediaPlayer1" Grid.ColumnSpan="3" Grid.Row="2" Height="105">
            <tulde:MediaPlayer.BitmapEffect>
                <DropShadowBitmapEffect Color="White" Direction="185"  
        ShadowDepth="25" Softness="1" Opacity="0.5"/>
            </tulde:MediaPlayer.BitmapEffect>
        </tulde:MediaPlayer>

    </Grid>
</Window>
